package com.hedl.practice.diyJava.array;

import java.util.Arrays;

public class JavaAndArray {
    public static void main(String[] args) {

        int[] ns = {1,4,9,16,25};
        String[] ns1 = {"lisi","daxigua","zhangsan","laowang","wangwu"};

        //方法一：遍历数组
        /*for (int i = 0;i < ns.length; i++){
            int n = ns[i];
            String name = ns1[i];
            System.out.println(n);
            System.out.println(name);
        }*/

        //方法二：for each
        /*for (int n : ns) {
            System.out.println(n);
        }

        for (String s : ns1) {
            System.out.println(s);
        }*/

        //直接打印出来的就是jvm的引用地址
        //System.out.println(ns);

        //方法三：使用--》Arrays.toString(ns)
        //System.out.println(Arrays.toString(ns));

        //System.out.println(ns.length);


        //练习，倒序
        for (int i = ns.length-1;i >= 0;i--){
            int n = ns[i];
            System.out.print(n+",");
        }
    }
}
